#ifndef _MSGNUM_H_
#define _MSGNUM_H_

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sqlite3.h> 

#define NUM_LEN 		10	
#define PWD_LEN 		20
#define NAME_LEN		20
#define MSG_LEN			512
#define ADDR_LEN 		128
#define PHONE_LEN		20

#define POWER_COM		0
#define POWER_ADM		1

/********************cmd num*****/
/*---common cmd---*/
#define COM_SHOW		1
#define RVS_PWD			11
#define RVS_NAME		12
#define RVS_SEX			13
#define RVS_ADDR		14
#define RVS_PHONE		15
#define RVS_MONEY		16
/*----------administrator cmd---*/
#define ADM_SHOW		2
#define ADM_RVS			3
#define ADM_ADD			4
#define ADM_DEL			5
#define ADM_LIST		6
#define BACK 			7

/*******************return num***/
#define OK				0
#define NO_USER			-1
#define ERROR			-2
#define REPEAT 			-3

/***sqlite word******************/
#define SQ_NUM			8	//数据库项目个数

#define	SQ_NUMBER		0
#define	SQ_PASSWORD		1
#define SQ_POWER		2
#define SQ_NAME			3
#define	SQ_SEX			4
#define SQ_ADDRESS		5
#define SQ_PHONE		6
#define SQ_MONEY		7
/*******************************/




#define err_log(log) \
	do\
	{\
		perror(log);\
		exit(1);\
	}while(0)

typedef struct sockaddr SA;

struct login{
	int flags;
	char number[NUM_LEN];
	char password[PWD_LEN];
};

struct MSG{
	int cmd;
	char msg[MSG_LEN];
};

struct ADD_USER{
	int power;
	char password[PWD_LEN];
	char name[NAME_LEN];
	int sex;
	char addr[ADDR_LEN];
	char phone[PHONE_LEN];
	unsigned long money;
};

#endif
